<?php
    include('./_con.php');
    $phone=$_REQUEST['phone'];
    $password=$_REQUEST['password'];

    $sql="select * from res where phone='$phone'";

    $res = $mysqli->query($sql);

    if($res->num_rows == 0){
        echo '{"hash":true,"msg":"用户名可用"}';  
    }
    
    if($res->num_rows > 0){
        echo '用户名已存在';
        die;
    }
    $sql_ins = "insert into res(phone,pass_word)values('$phone','$password')";
        // $res = $mysqli->query($sql_ins);

    // if($res){
    //     echo "<script>location.href='../html/login.html';</script>";
    // }
    
?>